
par(mar=c(3.2,3,2,1), mfrow=c(1,2), mgp=c(2,.3,0), tck=-.01)

year <- c(1980,1982,1984,1986,1988,1990,1992,1994,1996,1998,2000,2002,2004,2006,2008,2010,2012)
r1 <- c(.82,.93,.81,.7,.68,.68,.71,.78,.75,.7,.7,.71,.68,.71,.79,.97,.89)
r2 <- c(.76,.75,.7,.65,.61,.67,.64,.71,.77,.8,.8,.78,.87,.87,.9,1.05,.92)
r3 <- c(.93,.94,.89,.9,.92,.91,.89,.99,.97,.95,.93,.93,.95,.97,1,1.14,1.08)
r4 <- c(1.01,.91,.89,.83,.85,.83,.97,.97,1.05,1.04,1.08,.99,.99,.99,1.1,1.2,1.18)
d1 <- c(-.43,-.55,-.53,-.52,-.56,-.53,-.55,-.55,-.68,-.57,-.6,-.66,-.76,-.86,-.75,-.81,-.94)
d2 <- c(-.57,-.62,-.66,-.69,-.64,-.69,-.71,-.76,-.78,-.81,-.8,-.78,-.88,-.99,-.98,-1.09,-1.06)
d3 <- c(-.21,-.3,-.31,-.36,-.4,-.44,-.35,-.32,-.55,-.53,-.56,-.5,-.69,-.8,-.76,-.83,-.93)
d4 <- c(-.62,-.74,-.72,-.67,-.7,-.64,-.59,-.67,-.78,-.73,-.83,-.79,-.97,-1.03,-.97,-.97,-1.12)

plot(year, d1, type="l",axes=FALSE, ann=FALSE,lwd=2,ylim=c(-1.25,1.25),cex=1)
lines(year, d2, type="l",lty=2,lwd=2)
lines(year, d3, type="l",lty=3,lwd=2)
lines(year, d4, type="l",lty=4,lwd=2)
lines(year, r1, type="l",lty=1,lwd=2)
lines(year, r2, type="l",lty=2,lwd=2)
lines(year, r3, type="l",lty=3,lwd=2)
lines(year, r4, type="l",lty=4,lwd=2)

axis(1, at=year, lab=year,cex.axis=0.8)
title(xlab="Election year")

axis(2, las=1, at=c(-1.25,-1,-.75,-.5,-.25,0,.25,.5,.75,1,1.25),cex.axis=0.8)
abline(h=0,lty=2)
title(ylab="Average platform position")
box()
title("U.S. House Candidates")
text(2008,0.25,"Republicans",cex=0.8)
text(2008,-0.25,"Democrats",cex=0.8)
legend(1980,-1.15,horiz=TRUE,lty=c(1,2,3,4),lwd=2,legend=c("Closed","Semi-closed","Semi-open","Open"),cex=0.7)


year <- c(1990,1992,1994,1996,1998,2000,2002,2004,2006,2008,2010,2012)
r1 <- c(.34,.24,.54,.51,.52,.55,.53,.53,.6,.57,.65,.56)
r2 <- c(NA,NA,NA,.72,.58,.62,.63,.68,.69,.72,.79,.81)
r3 <- c(.89,.97,.85,.71,.78,.81,.81,.83,.84,.86,.91,.9)
r4 <- c(.94,.94,.78,.74,.82,.84,.89,.85,.88,.97,1.03,1.05)
d1 <- c(-.34,-.59,-.31,-.49,-.32,-.34,-.37,-.42,-.47,-.51,-.5,-.57)
d2 <- c(NA,NA,-.76,-.42,-.59,-.52,-.58,-.62,-.71,-.72,-.75,-.78)
d3 <- c(-.45,-.09,-.16,-.17,-.22,-.19,-.28,-.28,-.39,-.31,-.38,-.44)
d4 <- c(-.57,-.6,-.68,-.67,-.63,-.75,-.75,-.91,-.89,-.89,-.87,-1.05)

plot(year, d1, type="l",axes=FALSE, ann=FALSE,lwd=2,ylim=c(-1.25,1.25),cex=1)
lines(year, d2, type="l",lty=2,lwd=2)
lines(year, d3, type="l",lty=3,lwd=2)
lines(year, d4, type="l",lty=4,lwd=2)
lines(year, r1, type="l",lty=1,lwd=2)
lines(year, r2, type="l",lty=2,lwd=2)
lines(year, r3, type="l",lty=3,lwd=2)
lines(year, r4, type="l",lty=4,lwd=2)

axis(1, at=year, lab=year,cex.axis=0.8)
title(xlab="Election year")

axis(2, las=1, at=c(-1.25,-1,-.75,-.5,-.25,0,.25,.5,.75,1,1.25),cex.axis=0.8)
abline(h=0,lty=2)
title(ylab="Average platform position")
box()
title("State Legislative Candidates")
text(2010,.15,"Republicans",cex=0.8)
text(2010,-.15,"Democrats",cex=0.8)
legend(1990,-1.15,horiz=TRUE,lty=c(1,2,3,4),lwd=2,legend=c("Closed","Semi-closed","Semi-open","Open"),cex=0.7)


